package com.hziee.cosmanage.member.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hziee.common.utils.PageUtils;
import com.hziee.common.utils.Query;

import com.hziee.cosmanage.member.dao.TrainDao;
import com.hziee.cosmanage.member.entity.TrainEntity;
import com.hziee.cosmanage.member.service.TrainService;


@Service("trainService")
public class TrainServiceImpl extends ServiceImpl<TrainDao, TrainEntity> implements TrainService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TrainEntity> page = this.page(
                new Query<TrainEntity>().getPage(params),
                new QueryWrapper<TrainEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<TrainEntity> getUserTrain(Integer userId) {
        List<TrainEntity> entities = this.list(new QueryWrapper<TrainEntity>().eq("user_id", userId));
        return entities;
    }

}